package v1

import (
	"video-api/internal/model/input"
	"video-api/internal/model/out"

	"github.com/gogf/gf/v2/frame/g"
)

type GoodsInfoReq struct {
	g.Meta `path:"/goods" method:"post" summary:"获取商品详情" tags:"商品管理"`
	input.GoodsDetail
}

type GoodsListReq struct {
	g.Meta `path:"/goods/list" method:"post" summary:"获取商品列表" tags:"商品管理"`
	input.GoodsList
}

type GoodsRes struct {
	GoodsId   int64   `json:"goodsId" description:"商品id"`
	GoodsName string  `json:"goodsName" description:"商品名称"`
	Price     float64 `json:"price" description:"价格"`
	Coins     uint    `json:"coins" description:"积分价值"`
	Bonus     uint    `json:"bonus" description:"额外积分"`
}

func (eg *GoodsRes) DTO(detail *out.Goods) {
	if eg == nil {
		eg = new(GoodsRes)
	}
	eg.GoodsId = detail.Id
	eg.GoodsName = detail.Name
	eg.Coins = detail.Coins
	eg.Price = detail.Price
	eg.Bonus = detail.Bonus
	return
}
